<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>最大值最小值</title>
</head>
<body>


<script>
    var arr = [50,97,32,41,32,16,84,46];


    var min = arr[0];
    var max = arr[0];

    for(i=0;i<arr.length;i++){
        if (min>arr[i]){
            min = arr[i]
        }
        if (max<arr[i]){
            max = arr[i]
        }
    }
    console.log("最大值"+max);
    console.log("最小值"+min);


</script>

</body>
</html>